package com.hp.spring3apptest.spring.ui.controllers;

import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.hp.spring3apptest.spring.ui.components.StudentLogin;


/**
 * Handles requests for the application home page.
 */
@Controller
public class HomeController {

	//private static final Logger logger = LoggerFactory.getLogger(HomeController.class);

	private StudentLogin stuLogin;

	/**
	 * Simply selects the home view to render by returning its name.
	 */
	@Autowired
	public HomeController(StudentLogin sLogin) {
		stuLogin = sLogin;
	}

	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String home(Locale locale, Model model) {
		//logger.info("Welcome home! The client locale is {}", locale);

		model.addAttribute("key_stuLogin", stuLogin);
		return "home";
	}

}
